package config

type Application struct {
	Debug bool `yaml:"debug"`
	*Server
	*Mysql
	*Redis
	*Logger
	*Token
	*Zone
}

type Server struct {
	Env  string `yaml:"env"`
	Port int    `yaml:"port"`
	Cors bool   `yaml:"cors"`
}

type Mysql struct {
	Host            string `yaml:"host" json:"host"`
	Username        string `yaml:"username" json:"username"`
	Password        string `yaml:"password" json:"password"`
	DBName          string `yaml:"dBName" json:"dbName"`
	Charset         string `yaml:"charset" json:"charset"`
	MaxIdle         int    `yaml:"maxIdle" json:"maxIdle"`
	MaxOpen         int    `yaml:"maxOpen" json:"maxOpen"`
	Loc             string `yaml:"loc" json:"loc"`
	MultiStatements bool   `yaml:"multiStatements" json:"multiStatements"`
	ParseTime       bool   `yaml:"parseTime" json:"parseTime"`
	ShowSql         bool   `yaml:"showSql" json:"showSql"`
}

type Redis struct {
	Addr        string `yaml:"addr"`
	Password    string `yaml:"password"`
	MaxIdle     int    `yaml:"maxIdle"`
	MaxActive   int    `yaml:"maxActive"`
	IdleTimeout int    `yaml:"idleTimeout"`
	DB          int    `yaml:"dB"`
}

type Logger struct {
	RootPath      string `yaml:"rootPath"`
	TextFormat    string `yaml:"textFormat"`
	TimePrecision string `yaml:"timePrecision"`
	MaxSize       int    `yaml:"maxSize"`
	MaxBackups    int    `yaml:"maxBackups"`
	MaxAge        int    `yaml:"maxAge"`
	Compress      bool   `yaml:"compress"`
	Level         string `yaml:"level"`
}

type Token struct {
	JwtTokenSignKey         string `yaml:"jwtTokenSignKey"`
	JwtTokenOnlineUsers     int    `yaml:"jwtTokenOnlineUsers"`
	JwtTokenCreatedExpireAt int    `yaml:"jwtTokenCreatedExpireAt"`
	JwtTokenRefreshExpireAt int    `yaml:"jwtTokenRefreshExpireAt"`

	BindContextKeyName   string `yaml:"bindContextKeyName"`
	JwtSecret            string `yaml:"jwtSecret"`
	JwtIssuer            string `yaml:"jwtIssuer"`
	JwtCacheSecret       string `yaml:"jwtCacheSecret"`
	JwtTimeoutHours      int    `yaml:"jwtTimeoutHours"`
	JwtCacheTimeoutHours int    `yaml:"jwtCacheTimeoutHours"`
}

type Zone struct {
	Type  int `yaml:"type"`
	Local struct {
		Host      string `yaml:"host"`
		ImagePath string `yaml:"imagePath"`
	}
	Qiniu struct {
		Host       string `yaml:"host"`
		BucketName string `yaml:"bucketName"`
		AccessKey  string `yaml:"accessKey"`
		SecretKey  string `yaml:"secretKey"`
	}
}
